package org.ice4apps.talk.dao;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * TalkOrganization entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "talk_organization", catalog = "icetalk")
public class TalkOrganization implements java.io.Serializable {
    // Fields
    private String            id;
    private TalkEnterprise    talkEnterprise;
    private Long              features;
    private Integer           extensionLength;
    private Long              creationdate;
    private Long              updationdate;
    private Set<PublicNumber> publicNumbers = new HashSet<PublicNumber> (0);
    private Set<TalkOffice>   talkOffices   = new HashSet<TalkOffice> (0);

    // Constructors
    /** default constructor */
    public TalkOrganization () {
    }

    /** minimal constructor */
    public TalkOrganization (String id,
                             TalkEnterprise talkEnterprise,
                             Integer extensionLength,
                             Long creationdate) {
        this.id = id;
        this.talkEnterprise = talkEnterprise;
        this.extensionLength = extensionLength;
        this.creationdate = creationdate;
    }

    /** full constructor */
    public TalkOrganization (String id,
                             TalkEnterprise talkEnterprise,
                             Long features,
                             Integer extensionLength,
                             Long creationdate,
                             Long updationdate,
                             Set<PublicNumber> publicNumbers,
                             Set<TalkOffice> talkOffices) {
        this.id = id;
        this.talkEnterprise = talkEnterprise;
        this.features = features;
        this.extensionLength = extensionLength;
        this.creationdate = creationdate;
        this.updationdate = updationdate;
        this.publicNumbers = publicNumbers;
        this.talkOffices = talkOffices;
    }

    // Property accessors
    @Id
    @Column(name = "id", unique = true, nullable = false, length = 36)
    public String getId () {
        return this.id;
    }

    public void setId (String id) {
        this.id = id;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "enterprise", nullable = false)
    public TalkEnterprise getTalkEnterprise () {
        return this.talkEnterprise;
    }

    public void setTalkEnterprise (TalkEnterprise talkEnterprise) {
        this.talkEnterprise = talkEnterprise;
    }

    @Column(name = "features")
    public Long getFeatures () {
        return this.features;
    }

    public void setFeatures (Long features) {
        this.features = features;
    }

    @Column(name = "extension_length", nullable = false)
    public Integer getExtensionLength () {
        return this.extensionLength;
    }

    public void setExtensionLength (Integer extensionLength) {
        this.extensionLength = extensionLength;
    }

    @Column(name = "creationdate", nullable = false)
    public Long getCreationdate () {
        return this.creationdate;
    }

    public void setCreationdate (Long creationdate) {
        this.creationdate = creationdate;
    }

    @Column(name = "updationdate")
    public Long getUpdationdate () {
        return this.updationdate;
    }

    public void setUpdationdate (Long updationdate) {
        this.updationdate = updationdate;
    }

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "talkOrganization")
    public Set<PublicNumber> getPublicNumbers () {
        return this.publicNumbers;
    }

    public void setPublicNumbers (Set<PublicNumber> publicNumbers) {
        this.publicNumbers = publicNumbers;
    }

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "talkOrganization")
    public Set<TalkOffice> getTalkOffices () {
        return this.talkOffices;
    }

    public void setTalkOffices (Set<TalkOffice> talkOffices) {
        this.talkOffices = talkOffices;
    }
}